﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using CommonFoundation.DataModel;

namespace WHULive
{
    /// <summary>
    /// AddScheduleWindow.xaml 的交互逻辑
    /// </summary>
    public partial class AddScheduleWindow : Window
    {
        public AddScheduleWindow()
        {
            InitializeComponent();

        }

        private void SearchButton_Click(object sender, RoutedEventArgs e)
        {
            if (String.IsNullOrEmpty(this.SearchTextBox.Text))
            {
                MessageBox.Show("关键词不能为空");

                return;
            }

            LessonAdmin lessonAdmin = new LessonAdmin();

            this.LessonsListView.ItemsSource = lessonAdmin.Search(this.SearchTextBox.Text);
        }

        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            BindingSource.GetInstance().Lessons.Add((Lesson)this.LessonsListView.SelectedItem);

            MessageBox.Show("添加成功！");
        }


    }
}
